package com.shop.loan.model;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

@Getter
@Setter
@Entity
@Table(name = "s_user_login_log")
@Erupt(
        name = "用户登录记录"
)
public class UserLoginLog extends BaseModel {


    @Column(name = "user_id")
    private Long userId;

    @EruptField(
            views = @View(title = "客户端"),
            edit = @Edit(
                    title = "客户端",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "h5", value = "h5"),
                                    @VL(label = "app", value = "app"),
                            }
                    ))
    )
    private String platform;

    @EruptField(
            views = @View(title = "设备id"),
            edit = @Edit(
                    title = "设备id"
            )
    )
    private String deviceId;

    @EruptField(
            views = @View(title = "设备信息"),
            edit = @Edit(
                    title = "设备信息"
            )
    )
    private String deviceInfo;


    @EruptField(
            views = @View(title = "登录时间"),
            edit = @Edit(
                    title = "登录时间",
                    dateType = @DateType(type = DateType.Type.DATE_TIME)
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(title = "登录ip地址"),
            edit = @Edit(
                    title = "登录ip地址"
            )
    )
    private String ip;


}
